/**
 * @param {number} n
 * @return {number}
 */
 var climbStairs = function(n) {
  let dp = new Array(n)
  dp[0] = 1
  dp[1] = 2
  let i = 2
  while(i<n){
    dp[i] = dp[i-1]+dp[i-2]
    i++
  }
  return dp[n-1]
};

console.log(climbStairs(3));